package com.lgl.allpeoplevent.ventIndex.controller;

import com.lgl.allpeoplevent.base.controller.BaseController;
import com.lgl.allpeoplevent.util.ControllerUtil;
import com.lgl.allpeoplevent.ventIndex.service.VentLikeService;
import com.lgl.scsapi.system.model.PageData;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 吐槽点赞controller
 */
@Slf4j
@RestController
@RequestMapping(value="/ventLike")
public class VentLikeController extends BaseController {
    @Autowired
    private VentLikeService ventLikeService;

    //获取用户某年1-12月的点赞总数
    @RequestMapping(value="/countLikeTotal")
    public Object countLikeTotal(@RequestParam Integer year){
        PageData countPd = ControllerUtil.getCountParam(getSessionUser(),year);
        List<PageData> likeTotalList = ventLikeService.countLikeTotal(countPd);
        return ControllerUtil.countResult(countPd,likeTotalList);
    }
}